API Documentation for: 1.1.23
Show:

AssetManager (PIXI) Class

Defined in: AssetManager (PIXI):8
Namespace: cloudkid

[PIXI-only] Asset Manager is responsible for managing different resolutions of assets and spritesheets based on the resolution of the stage. This is a helpful optimization for PIXI which some low-hardware devices have a problem keeping up with.

Item Index

Methods

Properties

Methods

getAnims

(
  • anims
  • [maxDigits=4]
  • [outObj]
)
Object static

Defined in getAnims:230

Get the collection of assets that are also animations

Parameters:

  • anims Object

    The dictionary of animation assets

  • [maxDigits=4] Int optional

    Maximum number of digits, like 4 for an animation exported as anim_0001.png

  • [outObj] Object optional

    If already using an return object

Returns:

Object:

An collection of PIXI.Textures for each animation id suitable for use in PIXI.MovieClip

getPreferredScale

() Number static

Get the preferred scale amount

Returns:

Number:

The scale amount associated with the preferred size

getPreferredSize

() String static

Defined in getPreferredSize:99

Get the alias of the preferred size to use

Returns:

String:

The alias for the preferred size

getUrl

(
  • assetId
)
static

Defined in getUrl:143

Get a asset url by asset id

Parameters:

  • assetId String

    The unique asset kdy

init

(
  • config
  • width
  • height
)
static

Defined in init:80

Initialize the asset manager

Parameters:

  • config Object

    The configuration file which contains keys for "path", "scale", "sizing", "assets"

  • width Number

    The stage width

  • height Number

    The stage height

pickScale

(
  • width
  • height
)
private static

Defined in pickScale:121

Pick the preferred scale based on the screen resolution

Parameters:

  • width Number

    The stage width

  • height Number

    The stage height

unload

(
  • assetOrAsset
)
static

Defined in unload:184

Unload an asset

Parameters:

  • assetOrAsset Array | String

    The collection of assets or single asset id

unloadAsset

(
  • asset
)
private static

Defined in unloadAsset:206

Unload an asset

Parameters:

  • asset String

    The asset id to unload

Properties

assets

Object private static

Defined in assets:33

Dictionary of assets by asset id

assetUrlCache

Object private static

Defined in assetUrlCache:41

The cache of asset url paths

lowHW

Boolean static

Defined in lowHW:73

If we should use low hardware, if we know we're on a slow device

paths

Object private static

Defined in paths:57

The paths to each resolution folder, e.g., {"sd":"images/sd/", "tiny":"images/tiny/"}

scales

Object final static

Defined in scales:17

Dictionary of scales by asset id

scales

Object private static

Defined in scales:49

The scaling value for each asset size id, e.g., {"sd" : 1, "tiny" : 2}

sizeOrder

Array private static

Defined in sizeOrder:65

The collection of perferred size to load

sizes

Array private static

Defined in sizes:25

The available size definitions, e.g., {"maxSize":400, "order": ["tiny", "sd"]}